<template>
    <section id="main">
        <template v-for='user in users'>
           <div class="big">
               <router-link :to="{name: 'user', params: { id:user.id}, query: {name:'查看详情',flag:'true'}}">{{user.attributes.username}}</router-link>
              <router-link :to='user'></router-link>
           </div>
           <hr>
        </template>
    </section>
</template>

<script>
    import { mapState } from 'vuex';

    export default {

        name: 'List',

        data () {
            return {
                title: '',
                users: []
            };
        },
        computed: mapState(['user']),
        mounted(){
            this.getAllArticles()
        },
        methods:{
            getAllArticles(){
                let q = new this.$api.SDK.Query('_User');
                q.find().then((users) => {
                    this.users = users
                }).catch(this.fail);
            },
        }
    };
</script>

<style lang="css" scoped>
#main {
    margin: 15px 10px;
}

.big {
    font-size: 20px;
    line-height: 22px;
}

#main hr:last-child {
    display: none;
}
</style>
